package cn.kgc.service.impl;

import cn.kgc.dao.StudentDao;
import cn.kgc.dao.TeacherDao;
import cn.kgc.dao.impl.StudentImpl;
import cn.kgc.dao.impl.TeacherImpl;
import cn.kgc.entity.Student;
import cn.kgc.entity.Teacher;
import cn.kgc.service.StudentService;

import java.util.List;

public class StudentServiceImpl implements StudentService {
    //查询
    @Override
    public List<Student> searchs(int currentPage,int currentSize,String stunum,String name,String specialty) {
        StudentDao studentDao=new StudentImpl();
        List<Student> searchsList = studentDao.searchs(currentPage,currentSize,stunum,name,specialty);
        return searchsList;
    }

    @Override
    public int totalCount(String stunum,String name,String specialty) {
        StudentDao studentDao=new StudentImpl();
        return studentDao.totalCount(stunum,name,specialty);
    }

    @Override
    public int totalPage(int pageSize, String stunum, String name, String specialty) {
        StudentDao studentDao=new StudentImpl();
        return studentDao.totalPage(pageSize,stunum,name,specialty);
    }

    //增加
    @Override
    public int add(Student student) {
        StudentDao studentDao=new StudentImpl();
        return studentDao.add(student);
    }

    @Override
    public Student findById(String ids) {
        StudentDao studentDao = new StudentImpl();
        Student student = studentDao.getById(ids);
        return student;
    }

    @Override
    public int modifyStudent(Student student) {
        StudentDao studentDao = new StudentImpl();
        int count = studentDao.updateStudent(student);
        return count;
    }
}
